<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input placeholder="" type="file">
<button class="upload">上传</button>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<script>
    $(".upload").click(function () {
        var file = $("input")[0].files[0];
        console.log("file: ",file);

        var formdata = new FormData();
        formdata.append("file", file);
        console.log("formdata： ", formdata);

        $.ajax( {
            url:'http://127.0.0.1:8090/app/tool/UploadFile',
            data: formdata,
            type:'post',
            headers: {

            },
            contentType: false,
            processData: false,
            success: function(data) {
                console.log(data)
            },
            error : function() {
                alert("异常！");
            }
        });
    })
    //

</script>
</html>